package com.kyxx.topics.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Toast;

import com.kyxx.topics.R;
import com.kyxx.topics.adapter.VipItemAdapter1;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2016/9/24.
 */
public class VipItemFragment extends Fragment implements VipItemAdapter1.OnItemClickLitener{
    @Bind(R.id.recy_vip_item1)
    RecyclerView recy_vip_item1;
    private View view;
    private Context ctx;
    private int[] list = {R.mipmap.vip1,R.mipmap.vip2,R.mipmap.vip3,R.mipmap.vip4,R.mipmap.vip5};

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        ctx = getActivity();
        view = inflater.inflate(R.layout.fragment_vip_item1, container, false);
        ButterKnife.bind(this, view);
        logic();
        return view;
    }

    private void logic() {
        recy_vip_item1.setLayoutManager(new LinearLayoutManager(ctx));
        VipItemAdapter1 adapter1 = new VipItemAdapter1(list,ctx);
        adapter1.setOnItemClickLitener(this);
        recy_vip_item1.setAdapter(adapter1);
    }
    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.unbind(this);
    }

    @Override
    public void onItemClick(View view, int position) {
        Toast.makeText(ctx,"第"+position+"个",Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onItemLongClick(View view, int position) {

    }
}
